package tp4.composite;

import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;

public class Dossier extends Composant {

	private ArrayList<Composant> content;
	public Dossier(String path) {
		super(path);
		content = new ArrayList<Composant>();
	}
	
	public void ajouter(Composant pCom){
		content.add(pCom);
		pCom.setPath(this.getPath()+File.separator+pCom.getName());
	}
	public void supprimer(Composant pCom){
		content.remove(pCom);
	}

	public ArrayList<Composant> getContent() {
		return content;
	}
	@Override
	public String toString() {
		String string = " (+) "+super.toString()+"\n";
		for (Composant com : content) {
			string+="-->"+com+"\n";
		}
		
		return string;
	}
	

}
